/**
 * @namespace js.underas.core.Component
 * @memberof js.underas.core
 */


/**
 * @class
 * @param {String} tag
 * @param {String} content HTML of component
 */
js.underas.core.Component = new Class({
	"uid":0
	,"_html":null
	,"initialize":function(tagh,tagc){
		this.uid = js.underas.core.Underas.getUid();
		this._html = new Element(tagh);
		//this._html = Elements.from(tagp);
		this.getEle().set("html",tagc).set("id","uid_"+this.uid).setStyle("z-index",this.uid+1);
	}
	,"getEle":function(p_sel){
		if(!p_sel){
			return this._html;
		};		
		return this._html.getElement(p_sel);
	}
	,"appendChildX":function(p_childtoappend){
		this.getEle().grap(p_childtoappend.getEle());
	}
	,"append":function(p_childtoappend){
		this.getEle().grap(p_childtoappend.getEle());
	}
	,"setSize":function(nsize){
		var classes = this.getEle().get("class");
		var ns = classes.replace(/col\-sm\-(\d{1,2})/,"col-sm-"+nsize);
		this.getEle().erase('class').addClass(ns);
	}
	,"addEvent":function(p_on,p_event_fn,p_bind){
		if(p_bind){
			this.getEle().addEvent(p_on,p_event_fn.bind(p_bind));
		}else{
			this.getEle().addEvent(p_on,p_event_fn);
		}
		return this.getEle();
	}
	,"show":function(pshow){
		if(pshow){			
			this.getEle().setStyle("display","block");
		}else{
			this.getEle().setStyle("display","none");
		}
	}
});
	

